package com.gh.controller;

import com.gh.model.hosp.Schedule;
import com.gh.result.Result;
import com.gh.service.ScheduleService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Author Eric
 * @Date 2021/6/12 18:54
 * @Version 1.0
 */
//@CrossOrigin
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    @ApiOperation(value = "查询排班规则数据")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable long page,
                                  @PathVariable long limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode){
        Map<String , Object> map = scheduleService.getScheduleRule(page,limit,hoscode,depcode);
        return Result.ok(map);
    }
    /**
     * 根据医院编号，科室编号和工作日期，查询排班信息
     */
    @ApiOperation(value = "查询排班详细信息")
    @GetMapping("getScheduleList/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleList(@PathVariable String hoscode,
                                  @PathVariable String depcode,
                                  @PathVariable String workDate){
        List<Schedule> list = scheduleService.getScheduleList(hoscode,depcode,workDate);
        return Result.ok(list);
    }
}
